﻿@using JxAudio.Web.Vo
@using JxAudio.Web.Validators
@using JxAudio.Core.Entity
@using JxAudio.Web.Utils
@using System.Diagnostics.CodeAnalysis
@inherits StepBase

<ValidateForm Model="@UserInstallVo" OnValidSubmit="@OnSubmit">
    <GroupBox class="install_content">
        <div class="row g-3">
            <div class="form-group col-12">
                <BootstrapInput @bind-Value="@UserInstallVo.UserName"></BootstrapInput>
            </div>
            <div class="form-group col-12">
                <BootstrapInput @bind-Value="@UserInstallVo.Email"></BootstrapInput>
            </div>
            <div class="form-group col-12">
                <BootstrapInputNumber @bind-Value="@UserInstallVo.MaxBitRate"></BootstrapInputNumber>
            </div>
            <div class="form-group col-12">
                <BootstrapInput @bind-Value="@UserInstallVo.Password" type="password"></BootstrapInput>
            </div>
            <div class="form-group col-12">
                <BootstrapInput @bind-Value="@UserInstallVo.RePassword" type="password" ValidateRules="@Validators">
                </BootstrapInput>
            </div>
        </div>
    
    </GroupBox>
    <div class="text-center">
        <Button Text="上一步" OnClick="() => Prev?.Invoke()"></Button>
        <Button ButtonType="ButtonType.Submit">确认</Button>
    </div>
</ValidateForm>

@code {
    [NotNull]
    [Parameter]
    public UserInstallVo? UserInstallVo { get; set; }

    private List<IValidator> Validators { get; set; } = [new InstallValidator()];

    private Task OnSubmit(EditContext arg)
    {
        
        Next?.Invoke();
        return Task.CompletedTask;
    }
}